 <template>
	<div class="video-cont pad-bottom">
		<ul class="clear"  v-loading="loading">
			<li class="video-list fl" v-for="item of videoList" :key="item.id">
				<a class="thumbnail-m" @click="goToDetailPage(item.status_m3u8, item.id)">
					<img :src="BASE_URL + item.picture" >
				</a>
				<a  class="title-m" @click="goToDetailPage(item.status_m3u8, item.id)">{{item.video_name}}</a>
				<div class="user-op clear">
					<div class="user-name fl">
						<span>
							<img :src="BASE_URL+item.avatar_path">
						</span>
						<strong>{{item.user_name}}</strong>
					</div>
					<div class="user-xc fr">
						<i class="el-icon-video-play"></i>
						<strong>{{item.clicks}}</strong>
					</div>
				</div>
			</li>
			
		</ul>
		<el-pagination v-if="total_sum > page_size"
			class="pageing"
			@current-change="SizeChange"
			:current-page="page_index"
			:page-size="page_size"
			layout="total, prev, pager, next,jumper"
			:total="total_sum">
		</el-pagination>

		<!--  -->
		<div class="dependent" v-if="placeholder">
			<i class="ipng image_state01"></i>
			<p>还没发现任何相关的内容哦~</p>
		</div>
	</div>
</template>


<script>
	
	export default{
		data(){
			return {
				screen: '1',
				search: '',
				page_index: 1,
				page_size: 12,
				total_sum: 10,
				videoList: [],
				placeholder: false,
				loading: true,
				create_id: this.$route.query.id,
			}
		},
		created(){
			this.getVideoList()
		},
		methods: {
			getVideoList(){
				let success = (res =>{
					this.videoList = res.data.data;
					this.total_sum = parseInt(res.data.data_sum)
					this.loading = false
					this.placeholder = this.videoList.length === 0 ? true : false
				});

				if (this.$g.user_id == this.$route.query.id) {
					this.$ajax.get('api/video/video_list',{
						params: {
							create_id: this.$route.query.id,
							page_index: this.page_index,
							page_size:this.page_size,
							status: '1,2,3',
						},
						func:{success:success}
					})
				}else{
					this.$ajax.get('api/video/video_list',{
						params: {
							create_id: this.$route.query.id,
							page_index: this.page_index,
							page_size:this.page_size,
							status: '1',
							authority:1
						},
						func:{success:success}
					})
				}
			},
			spaceRoutr(){
				this.$router.push({path: '/teach/space',query: {id: 4}})
			},
			SizeChange(val) {
				this.page_index = val;
				this.getVideoList()
			}
		},
	}
</script>